package poly;
class Animal{
	public void eat(){
		System.out.println("animal eat");
	}	
}
class Dog extends Animal{
	public void watchHome(){
		System.out.println("dog watching home!");
	}	
	public void eat(){
		System.out.println("dog eat bone");
	}
}
class Cat extends Animal{
	public void catchMouse(){
		System.out.println("cat catching mouse");
	}
	public void eat(){
		System.out.println("cat eating fish");
	}
}

public class TestPoly{
	public static void show(Animal animal){
		animal.eat();	
	}
	public static Animal getAnimal(int i){
		if(i==1){
			return new Dog();
		}else if(i==2){
			return new Cat();
		}else{
			return new Animal();
		}
	}
	public static double getNumber(){
		return 10;
	}
	public static void main(String[]args){
		Dog d = new Dog();
		Animal a = new Dog();
	//	a.watchHome();
		d.watchHome();
		a.eat();
		Animal a1 = new Cat();
		//a1.catchMouse();
		Animal a2 = new Animal();
		show(a2);
		show(d);
		show(new Cat());
		
		//Dog d1 = getAnimal(1);
		//int i = getNumber();
		Animal a3 = getAnimal(1);
		Dog d4 = (Dog)Animal;
		d4.watchHome();
		double d10 = 100;
		int i10 = (int)d10;
	}
}